if ENABLE_DEBUG
ASSEMBLY_COMPILER_COMMAND = gmcs
ASSEMBLY_COMPILER_FLAGS =  -noconfig -codepage:utf8 -warn:4 -optimize- -debug -define:DEBUG "-define:GMCS_SOURCE" $(MONODEVELOP_CSFLAGS)

ASSEMBLY = bin/Debug/@ADDIN_NAME@.dll
ASSEMBLY_MDB = $(ASSEMBLY).mdb
COMPILE_TARGET = library
PROJECT_REFERENCES = 
BUILD_DIR = bin/Debug

MONODEVELOP_FSHARPBINDING_DLL_MDB_SOURCE=bin/Debug/@ADDIN_NAME@.dll.mdb
MONODEVELOP_FSHARPBINDING_DLL_MDB=$(BUILD_DIR)/@ADDIN_NAME@.dll.mdb

endif

if ENABLE_RELEASE
ASSEMBLY_COMPILER_COMMAND = gmcs
ASSEMBLY_COMPILER_FLAGS =  -noconfig -codepage:utf8 -warn:4 -optimize+ "-define:GMCS_SOURCE" $(MONODEVELOP_CSFLAGS)

ASSEMBLY = bin/Release/@ADDIN_NAME@.dll
ASSEMBLY_MDB = 
COMPILE_TARGET = library
PROJECT_REFERENCES = 
BUILD_DIR = bin/Release

MONODEVELOP_FSHARPBINDING_DLL_MDB=

endif

ADDIN_CONFIG = $(BUILD_DIR)/FSharpBinding.addin.xml
REPO_DIR = $(BUILD_DIR)
ADDIN_PACKAGE = $(REPO_DIR)/@ADDIN_NAME@.mpack
ADDIN_REPOSITORY = $(REPO_DIR)/index.html $(REPO_DIR)/main.mrep $(REPO_DIR)/root.mrep

AL=al2
SATELLITE_ASSEMBLY_NAME=.resources.dll

PROGRAMFILES = \
	$(MONODEVELOP_FSHARPBINDING_DLL_MDB)  $(ADDIN_CONFIG) $(ADDIN_PACKAGE) $(ADDIN_REPOSITORY)


RESGEN=resgen2
	
all: $(ASSEMBLY) $(PROGRAMFILES) 

$(ADDIN_REPOSITORY): $(ADDIN_PACKAGE)
	$(MDTOOL) setup rep-build $(REPO_DIR)
	touch $(ADDIN_REPOSITORY)
	@echo "##"
	@echo "## " A Mono repository with the add-in has been created in $(REPO_DIR)
	@echo "## " You can add the repository and install the add-in using MonoDevelop GUI.
	@echo "## " Alternatively, use the commands below.
	@echo "##"
	@echo $(MDTOOL) setup ra file://`pwd`/$(REPO_DIR) "# add the repository"
	@echo $(MDTOOL) setup ru "# update the list of available add-ins"
	@echo $(MDTOOL) setup la "# display the list of available add-ins"
	@echo $(MDTOOL) setup i MonoDevelop.@ADDIN_ID@,@PACKAGE_VERSION@ "# install the add-in"

$(ADDIN_PACKAGE): $(ADDIN_CONFIG) $(ASSEMBLY)
	[ -d $(REPO_DIR) ] || $(MKDIR_P) $(REPO_DIR)
	$(MDTOOL) setup pack $(ADDIN_CONFIG) -d:$(REPO_DIR)

$(ADDIN_CONFIG): FSharpBinding.addin.xml
	cp FSharpBinding.addin.xml $(ADDIN_CONFIG)

FILES = \
	Gui/CodeGenerationPanel.cs \
	Project/FSharpCompilerParameters.cs \
	FSharpLanguageBinding.cs \
	FSharpBindingCompilerManager.cs \
	gtk-gui/generated.cs \
	Gui/CompilerOptionsPanelWidget.cs \
	Project/FSharpResourceIdBuilder.cs \
	gtk-gui/FSharpBinding.CodeGenerationPanelWidget.cs \
	gtk-gui/FSharpBinding.CompilerOptionsPanelWidget.cs \
	Gui/GlobalOptionsPanel.cs \
	gtk-gui/FSharpBinding.GlobalOptionsPanelWidget.cs \
	Commands/FSharpBindingNodeExtension.cs 

DATA_FILES = 

RESOURCES = \
	templates/ConsoleProject.xpt.xml \
	templates/EmptyFSharpFile.xft.xml \
	templates/EmptyProject.xpt.xml \
	FSharpBinding.addin.xml \
	gtk-gui/gui.stetic \
	gtk-gui/objects.xml \
	md1format.xml \
	icons/FSharp.FileIcon \
	templates/EmptyFSIFile.xft.xml \
	icons/arrow_down.png \
	icons/arrow_up.png 

EXTRAS = 

REFERENCES =  \
	$(MONO_ADDINS_LIBS) \
	Mono.Posix \
	$(MONODEVELOP_LIBS) \
	System \
	System.Drawing \
	System.Xml \
	$(GTK_SHARP_20_LIBS)

DLL_REFERENCES = 

CLEANFILES = $(PROGRAMFILES) 

include $(top_srcdir)/Makefile.include




$(eval $(call emit_resgen_targets))
$(build_xamlg_list): %.xaml.g.cs: %.xaml
	xamlg '$<'

$(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) $(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list) $(build_satellite_assembly_list)
	mkdir -p $(shell dirname $(ASSEMBLY))
	$(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$(ASSEMBLY) -target:$(COMPILE_TARGET) $(build_sources_embed) $(build_resources_embed) $(build_references_ref)
